package com.sean.common.page;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class ResultPagination<T> extends Pagination implements Serializable {

	private static final long serialVersionUID = 1L;

	private List<T> rows;// 查询出的数据

	private int total;// 总记录数

	private int pageCount;// 总页数

	private boolean next = false;// 是否能下一页

	private boolean previous = false;// 是否能上一页
	
	public ResultPagination() {
		this.rows = new ArrayList<T>();
		this.total = 0;
		this.pageCount = 0;
	}

	public ResultPagination(PageRowBounds rowBounds, Map<String, Object> paramMap, List<T> rows) {
		this.next = rowBounds.isNext();
		this.previous = rowBounds.isPrevious();
		this.pageCount = rowBounds.getPageCount();
		this.pageSize = rowBounds.getPageSize();
		this.pageNum = rowBounds.getPageNum();
		this.total = rowBounds.getRowCount();
		this.rows = rows;
		this.paramMap = paramMap;
	}

	public List<T> getRows() {
		return rows;
	}

	public void setRows(List<T> rows) {
		this.rows = rows;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getPageCount() {
		return pageCount;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public boolean isNext() {
		return next;
	}

	public void setNext(boolean next) {
		this.next = next;
	}

	public boolean isPrevious() {
		return previous;
	}

	public void setPrevious(boolean previous) {
		this.previous = previous;
	}
}
